package com.neo.task;

import com.neo.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by summer on 2016/12/1.
 */

@Component
public class SchedulerTask {

    private int count=0;
    @Autowired
    MailService mailService;

    @Scheduled(cron="*/6 * * * * ?")
    private void process(){
        mailService.sendSimpleMail("sunpengpeng@lvmama.com","test simple mail"," hello this is simple mail");
        String content="<html>\n" +
                "<body>\n" +
                "    <h3>hello world ! 这是一封html邮件!</h3>\n" +
                "</body>\n" +
                "</html>";
        mailService.sendHtmlMail("sunpengpeng@lvmama.com","test simple mail",content);
        System.out.println("this is scheduler task runing  "+(count++));
    }

}
